﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
using PRJ1109.Pages;
using WpfAnimatedGif;

namespace PRJ1109.Pages
{
    internal class EmoticonManage
    {
         public UseEmotion useEmotion = new UseEmotion();

         public void SetEmoticon(string emoticonName, Image gifImage)
        {
            string imagePath = useEmotion.GetEmoticonImagePath(emoticonName);

            if (!string.IsNullOrEmpty(imagePath))
            {
                BitmapImage bitmap = new BitmapImage();
                bitmap.BeginInit();
                bitmap.UriSource = new Uri(imagePath);
                bitmap.EndInit();
                ImageBehavior.SetAnimatedSource(gifImage, bitmap);
            }
        }
    }
}
